<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<div class="panel panel-default">
  <div class="panel-heading">查询条件</div>
  <div class="panel-body">
    <div class="row">
			<form class="form-inline" action="${pageContext.request.contextPath }/FindOrdersServlet" method="GET">
				<input type="hidden" name="page" value="1">
				<div class="col-md-4">
					<div class="form-group">
					    <label>订单编号：</label>
					    <input type="text" name="id" class="form-control">
					  </div>
				</div>
				<div class="col-md-4">
					<div class="form-group">
					    <label>收件人：</label>
					    <input type="text" name="receiverName" class="form-control">
					  </div>
				</div>
				<div class="col-md-4">
					<input class="btn btn-primary" type="submit" value="查询" style="margin-right: 30px;">
					<input class="btn btn-default" type="reset" value="重置">
				</div>
			</form>
		</div>
  </div>
</div>
<table class="table table-bordered">
	<tr>
		<th>订单编号</th>
		<th>收件人</th>
		<th>地址</th>
		<th>联系电话</th>
		<th>总价</th>
		<th>所属用户</th>
		<th>订单状态</th>
		<th>操作</th>
	</tr>
	<c:forEach items="${orders}" var="order">
	   <tr>
	   		<td><c:out value="${order.id}" /></td>
	   		<td><c:out value="${order.receiverName}" /></td>
	   		<td><c:out value="${order.receiverAddress}" /></td>
	   		<td><c:out value="${order.receiverPhone}" /></td>
	   		<td><c:out value="${order.money}" /></td>
	   		<td><c:out value="${order.user.username}" /></td>
	   		<td>
	   			<c:if test="${ order.paystate == 1 }">
	   				已支付
	   			</c:if>
	   			<c:if test="${ order.paystate == 0 }">
	   				未支付
	   			</c:if>
   			</td>
   			<td>
   				<a class="btn btn-info" href="${pageContext.request.contextPath }/FindOrderByIdServlet?id=${order.id}" role="button">详情</a>
   				<a class="btn btn-danger" href="${pageContext.request.contextPath }/DelOrderByIdServlet?id=${order.id}" role="button">删除</a>
   			</td>
	   </tr>
	</c:forEach>
</table>
<nav>
  <ul class="pager">
  	<c:if test="${hasPrev}">
  		<li class="previous"><a href="${pageContext.request.contextPath}/FindOrdersServlet?page=${_page - 1}"><span aria-hidden="true">&larr;</span>上一页</a></li>
  	</c:if>
  	<c:if test="${hasNext}">
    	<li class="next"><a href="${pageContext.request.contextPath}/FindOrdersServlet?page=${_page + 1}">下一页 <span aria-hidden="true">&rarr;</span></a></li>
  	</c:if>
  </ul>
</nav>